package sctu.edu.java.year2016.team04.baiyunfei.day20160615.chapter9_3;


/**
 * c创建一个类，在类中定义一个形参为接口类型的方法
 * 并调用接口的方法在类的方法中创建一个实现接口的匿名内部类用于实现接口中的方法
 * Created by DE on 2016/6/16.
 */
public class AppleTree implements Chapter9_3 {


    public void tree() {
        String tree1 = "apple";
        System.out.println("this is " + tree1 + " tree");
    }



    public static void main(String[] args) {

  Chapter9_3 ATree=new Chapter9_3() {
      @Override
      public void tree() {
          String tree1 = "bread";
          System.out.println("this is " + tree1 + " tree");
      }
  };
        ATree.tree();

        AppleTree appleTree=new AppleTree();
        appleTree.fram(ATree);
    }


    public void fram(Chapter9_3 TreeName) {
        System.out.println("the tree is "+TreeName.tree1);

    }
}
